home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / fgl110c.zip / 10-01.C < prev    next >
Text File  |  1992-01-31  |  782b  |  38 lines

  1. #include <fastgraf.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. void main(void);
  6.  
  7. void main()
  8. {
  9.    int new_mode, old_mode;
  10.    int x;
  11.  
  12.    /* initialize the video environment */
  13.  
  14.    new_mode = fg_bestmode(320,200,1);
  15.    if (new_mode < 0 || new_mode == 12) {
  16.       printf("This program requires a 320 ");
  17.       printf("x 200 color graphics mode.\n");
  18.       exit(1);
  19.       }
  20.    old_mode = fg_getmode();
  21.    fg_setmode(new_mode);
  22.  
  23.    /* move the object across the screen */
  24.  
  25.    for (x = -20; x < 320; x+=5) {
  26.       fg_setcolor(10);
  27.       fg_clprect(x,x+19,95,104);
  28.       fg_waitfor(1);
  29.       fg_setcolor(0);
  30.       fg_clprect(x,x+19,95,104);
  31.       }
  32.  
  33.    /* restore the original video mode and return to DOS */
  34.  
  35.    fg_setmode(old_mode);
  36.    fg_reset();
  37. }
  38.